/*
 * GameMap.h
 *
 *  Created on: Jun 20, 2012
 *      Author: The Almighty Eric
 */

#ifndef GAMEMAP_H
#define GAMEMAP_H
#include <list>
#include "SDL.h"
#include <string>
#include "engine.h"
#include "MapObject.h"
#include "MapChunk.h"
#include <sstream>
#include <iostream>
#include <fstream>
#include <cmath>

class GameMap
{
public:
	//Attributes
	std::string name;
	std::string audio;
	std::string background;
	int w, h;
	std::list<MapObject*>::iterator it;
	std::list<MapChunk*>::iterator cit;

	//Chunk
	std::list<MapChunk*> Chunks;

	GameMap();
	void setbg(std::string bg);
	void setname(std::string n);
	void setaudio(std::string a);
	void setdimensions(int width, int height);
	void placeobject(int x, int y, int z, int w, int h, SDL_Surface *image, std::string s, bool fv, bool fh);
	void eraseobject(std::list<MapObject*>::iterator iter);
	std::list<MapObject*>::iterator collisione(int mousex, int mousey, engine *e);
	bool collision(int mousex, int mousey, int w, int h, engine *e);
	void clearGameMap();
	Vect chunkhash(int x, int y, int z);
	std::list<MapChunk*>::iterator getChunk(Vect v);
	bool ChunkExists(Vect v);
	bool collisionBox(SDL_Rect box);
};

#endif /* GameMap_H */
